let ajaxtime=0
export const request = (params) => {
    ajaxtime++
    wx.showLoading({
        title: '加载中...',
        mask:true
      })
    return new Promise((resolve, reject) => {
        let baseUrl = 'https://api-hmugo-web.itheima.net/api/public/v1/'
        wx.request({
            ...params,
            url: baseUrl + params.url,
            success: (result) => {
                resolve(result)
            },
            fail: (err) => {
                reject(err)
            },
            complete:()=>{
                ajaxtime--
                if(ajaxtime==0){
                    wx.hideLoading()
                }
            }
        })
    })
}